open Gl;;
open Ogl;;

type camera =
{
  transform : Matrix.matrix4;
  fov : float;
  aspect : float;
  near : float;
  far : float;
};;

let viewFrom c =
  loadMatrix c.transform cgl_modelview;;

let setProjection c = 
  glMatrixMode cgl_projection;
  glLoadIdentity () ;
  Glu.perspective c.fov c.aspect c.near c.far;;

let make ~fov:fi ~aspect:a ~near:n ~far:f =
  { transform = Matrix.identity () ;
    fov = fi;
    aspect = a;
    near = n;
    far = f; };;
